﻿<%@ Page Language="C#" MasterPageFile="~/Game/Game.Master" AutoEventWireup="true"
    CodeBehind="Main.aspx.cs" Inherits="smallDeimos.Game.Alliance.Main" Title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label><br />
    <br />
    
    <asp:LinkButton ID="LinkButton2" runat="server" PostBackUrl="JoinAlliance.aspx">Join alliance</asp:LinkButton><br />
    <asp:LinkButton ID="LinkButton1" runat="server" PostBackUrl="CreateAlliance.aspx">Create alliance</asp:LinkButton>
<asp:Panel ID="Panel1" runat="server">
<table><tr valign="top"><th>Informations</th><th>Member list</th></tr>
<tr valign="top"><td></td><td>
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
        DataSourceID="SqlDataSource1">
        <Columns>
            <asp:HyperLinkField DataTextField="PlayerName" HeaderText="Player" DataNavigateUrlFields="PlayerId" DataNavigateUrlFormatString="~/Game/PlayerInfo.aspx?pId={0}"/>
        </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:smallDeimosConnectionString %>" 
        
        SelectCommand="SELECT Players.PlayerName, Players.PlayerId FROM AllianceMembers INNER JOIN Players ON AllianceMembers.PlayerId = Players.PlayerId WHERE (AllianceMembers.AllianceId = @aId)">
        <SelectParameters>
            <asp:CookieParameter CookieName="sd_aId" Name="aId" />
        </SelectParameters>
    </asp:SqlDataSource>
</td></tr>
<tr><th colspan="2">Shared incomings screen</th></tr>
<tr><td colspan="2">
    <asp:GridView ID="GridView2" runat="server" 
        DataSourceID="SqlDataSource2" Width="688px" AllowSorting="True">
        <EmptyDataTemplate>
            There are no incomings.
        </EmptyDataTemplate>
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
        ConnectionString="<%$ ConnectionStrings:smallDeimosConnectionString %>" 
        
        
        SelectCommand="SELECT DATEADD(hour, (SELECT TimeZone FROM Players WHERE (PlayerId = @PlayerId)), News.Date) AS Time, Players_2.PlayerName AS Player, News.Message FROM News INNER JOIN Players AS Players_2 ON News.PlayerId = Players_2.PlayerId INNER JOIN AllianceMembers ON AllianceMembers.PlayerId = Players_2.PlayerId WHERE (News.Message LIKE 'Incoming fleet of%') AND (AllianceMembers.AllianceId = @aId) AND (DATEADD(hour, (SELECT TimeZone FROM Players AS Players_1 WHERE (PlayerId = @PlayerId)), News.Date) &gt; GETDATE())">
        <SelectParameters>
            <asp:CookieParameter CookieName="sd_id" Name="PlayerId" />
            <asp:CookieParameter CookieName="sd_aId" Name="aId" />
        </SelectParameters>
    </asp:SqlDataSource>
</td></tr>
</table>
</asp:Panel>
</asp:Content>

